package dobest.ray.com.jiongjiong.activity.login;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import dobest.ray.com.jiongjiong.R;
import dobest.ray.com.jiongjiong.activity.BaseActivity;
import dobest.ray.com.jiongjiong.bean.PresenterData;
import dobest.ray.com.jiongjiong.callback.PresenterCallBack;
import dobest.ray.com.jiongjiong.views.NavigationBar;

/**
 * Created by Ray on 2016/3/16.
 * https://github.com/ray0807
 */
public class RegisterActivity extends BaseActivity<LoginPresenter> implements View.OnClickListener, PresenterCallBack {
    private Button btn_next;
    private EditText edit_account;
    private EditText et_v_code;
    private TextView tv_get_code;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        findViews();
        init();
        addListeners();
    }

    @Override
    public void findViews() {
        navi = (NavigationBar) findViewById(R.id.navi);
        navi.setTitle("注册");
        navi.setBackListener(R.mipmap.img_back, "取消");
        btn_next = (Button) findViewById(R.id.btn_next);


        edit_account = (EditText) findViewById(R.id.edit_account);
        et_v_code = (EditText) findViewById(R.id.et_v_code);
        tv_get_code = (TextView) findViewById(R.id.tv_get_code);
    }

    @Override
    public void init() {
        setPresenter(new LoginPresenter(this), this);

    }

    @Override
    public void addListeners() {
        btn_next.setOnClickListener(this);
        tv_get_code.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_next:
                Intent it = new Intent(this, RegisterSetPasswordActivity.class);
                startActivity(it);
                break;
            //获取验证码
            case R.id.tv_get_code:
                getPresenter().getVCode(this, "158");
                break;
        }
    }

    @Override
    public <T> void callBackPresenter(PresenterData<T> data) {

    }
}
